// ------login page
import { Component, Vue } from 'vue-property-decorator';
import Http, { Api } from '@/request';

@Component({
  components: {}
})
export default class TeamList extends Vue {
  private form: any;

  private handleSubmit(e: any) {
    e.preventDefault();
    this.form.validateFields((err: any, values: any) => {
      if (err) {
        return;
      }
      console.log('接收到的表单值: ', values);

      Http.post(Api.INSERT_TEAM, values).then(res => {
        if (res.data.success) {
          this.$message.success('创建成功');
          this.$router.push({ name: 'work' });
        } else {
          this.$message.error(res.data.errorMsg);
        }
      });
    });
  }

  private beforeCreate() {
    this.form = this.$form.createForm(this);
  }
}
